<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateInCodesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('in_codes', function (Blueprint $table) {
            $table->increments('id');
            $table->string('code')->unique()->comment('邀请码');
            $table->integer('user_id')->comment('创建人')->default(0);
            $table->boolean('status')->comment('使用状态')->default(0);
            $table->integer('used_user')->comment('使用者')->nullable();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('in_codes');
    }
}
